<?php
class List_hotels extends MY_Frontend{
    
    public function __construct() {
        parent::__construct();
    }

    function index($zone_hotel_id=1,$offset=0)
    {
        $this->session->set_userdata('REDIRECT' , uri_string());
        
        $this->load->model('zone_hotel_model');
        $this->data['zone_hotel']=$this->zone_hotel_model->get_by_id($zone_hotel_id)->zone_hotel_name_en;
        $this->load->model('hotel_model');
        $this->data['list_hotel']=$this->hotel_model->get_by_zone($zone_hotel_id,$offset,5);
        
        $this->load->library('pagination');
        $config['base_url'] = base_url().'list_hotels/index/'.$zone_hotel_id;
        $config['uri_segment'] = 4;
        $config['total_rows'] = $this->hotel_model->get_num_rows_by_zone($zone_hotel_id);
        $config['per_page'] = 5;
        
        $this->pagination->initialize($config);        
        $this->data['pag'] = $this->pagination->create_links();
   
        $this->layout->view('frontend/list_hotels.php', $this->data);    
    }   
}